package just.stuff.morsels;

import just.stuff.morsels.objects.User;

import org.apache.wicket.Request;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebSession;

public class MorselSession extends WebSession {

	private User user;
	private String loginRedirectUrl;
	
	public MorselSession(Request request) {
		super(request);
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	public static MorselSession get() {
		return (MorselSession) Session.get();
	}

	public String getLoginRedirectUrl() {
		return loginRedirectUrl;
	}

	public void setLoginRedirectUrl(String loginRedirectUrl) {
		this.loginRedirectUrl = loginRedirectUrl;
	}
	
	public static boolean isSignedIn() {
		return get().getUser() != null;
	}
	

}
